@extends('default.layouts.adminPublic')
@section('title', '企业采集列表')
@section('headcss')
    @parent
    <link rel="stylesheet" href="{{asset('/default/css/admin/indexList.css')}}">
    @endsection
    @section('content')
            <!--导航开始-->
    <div class="crumb_warp">
        <i class="fa fa-home"></i> <a href="{{url('admin/company_list')}}">首页</a> &raquo; 采集列表管理
    </div>
    <!--导航结束-->
    <!--结果集标题与导航组件 开始-->

    <div class="con">
        <div class="conMain">
            <div class="result_wrap">
                <div class="search">
                    <span style="margin-right: 20px;"><a href="{{url('admin/company_add')}}"><i class="fa fa-plus"></i>添加企业采集</a></span>
                    <span style="margin-right: 20px;"><a href="{{url('admin/company_list')}}"><i
                                    class="fa fa-recycle"></i>企业采集列表</a></span>
                </div>
                <div class="message"><p>
                        目前共查找到<strong>{{$collectionCompany->total()}}</strong>份临时企业！且每页显示条数为{{$collectionCompany->perPage()}}
                        条。</p></div>
            </div>
            <div class="manage">
                @include('flash::message')
            </div>
            <div class="conInfo">
                <form name="thisForm" id="thisForm" action="" method="post">
                    {{csrf_field()}}
                    <div class="conList" id="conList">
                        <dl class="one">
                            <dt><input name="selectall" type="checkbox" value="1" onclick="CheckAll(this)"/></dt>
                            <dd class="company1">企业名称</dd>
                            <dd class="company2">联系人</dd>
                            <dd class="company3">手机号码</dd>
                            <dd class="company4">电话号码</dd>
                            <dd class="company5">企业地址</dd>
                            <dd class="company6">企业操作</dd>
                        </dl>
                        @if($collectionCompany->count() > 0 )
                            @foreach($collectionCompany as $v)
                                <dl id="list{{$v->id}}">
                                    <dt><input name="selected_id[]" type="checkbox" value="{{$v->id}}"/></dt>
                                    <dd class="company1">{{str_limit($v->name,36)}}</dd>
                                    <dd class="company2">{{$v->contacts}}</dd>
                                    <dd class="company3">{{$v->mobile}}</dd>
                                    <dd class="company4">{{$v->phone}}</dd>
                                    <dd class="company5">{{str_limit($v->address,36)}}</dd>
                                    <dd class="company6">
                                        <span><a onclick="delCompany('{{$v->id}}')">删除企业</a></span>
                                    </dd>
                                </dl>
                            @endforeach
                        @else
                            <div class="nullcon">对不起！没有符合条件的记录！</div>
                        @endif
                        <dl class="last">
                            <dt>
                                <input name="selectall" id="selectall" type="checkbox" value="1"
                                       onclick="CheckAll(this)"/>
                                <label for="selectall">全选</label>
                            </dt>
                        </dl>
                    </div>
                </form>
                <div class="page_list" style="width: 100%; float: left; margin-top:15px;">
                    {!! $collectionCompany->links() !!}
                </div>
            </div>

            <div class="stopper" style="margin-top:10px; border-top: 1px solid #e5e5e5"></div>
        </div>
    </div>
    <!--结果集标题与导航组件 结束-->
@endsection

@section('footerjs')
    @parent
    <script>
        /**
         * 删除账号
         * param id
         */
        function delCompany(id){
            layer.confirm('您确定要删除这个企业吗？', {
                btn: ['确定', '取消'] //按钮
            }, function(){
                $.post('/admin/company_del/' + id, {'_token': "{{csrf_token()}}"}, function(data){
                    if(data.status == 1){
                        layer.msg(data.msg, {icon: 6});
                        $('#list' + id).remove();
                    }else{
                        layer.msg(data.msg, {icon: 5});
                    }
                });
            });
        }
    </script>
@endsection